Skip to content

Fix building DM halve showing Halve again after first use (#1331)#1496

Open
tiweb442 wants to merge 3 commits into
lanedirt:mainfrom
tiweb442:fix/1331-building-dm-complete
Open

Fix building DM halve showing Halve again after first use (#1331)#1496
tiweb442 wants to merge 3 commits into
lanedirt:mainfrom
tiweb442:fix/1331-building-dm-complete

Conversation

@tiweb442

Copy link
Copy Markdown
Contributor

Summary

  • Add dm_halved / dm_completed to building queues (mirrors shipyard)
  • Show Complete instead of Halve after first DM halve
  • Add completeBuilding endpoint and tests

Fixes #1331

Test plan

  • Halve a building once — button switches to Complete
  • Complete finishes the building instantly
  • Second halve attempt is rejected

Made with Cursor

@tiweb442

Copy link
Copy Markdown
Contributor Author

Tested on production at https://space.tiweb-host.com — deployed locally for validation. Cross-ref tiweb442/OGameX branches.

@Geda173 Geda173 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went through this end to end and it holds up well. It faithfully mirrors the existing shipyard halve→complete flow: the new dm_halved/dm_completed columns, the double-halve guard, and the completeBuilding service/endpoint/route are structurally the same as halveUnit/completeUnit, right down to the Complete-button blade logic. I traced the view wiring (dm_halvedBuildingQueueViewModel → active item → $build_active->dm_halved) and the button switches correctly.

Nice touch: changing the displayed cost from time_total to time_countdown actually fixes a pre-existing mismatch. The cost is charged on remaining time, so the old display over-stated it. Now what's shown matches what's charged.

One thing before merge: this branch needs a rebase and some manual merge conflict resolution. Once that is out of the way we should be good to go.

root and others added 2 commits July 24, 2026 22:03
)

Mirror shipyard queue behavior: track dm_halved on building queues, show
Complete after the first halve, and add completeBuilding endpoint.

Co-authored-by: Cursor <cursoragent@cursor.com>
Align HalvingIntegrationTest with one-halve-then-complete behavior so
CI no longer expects a second building halve to succeed.

Co-authored-by: Cursor <cursoragent@cursor.com>
@tiweb442
tiweb442 force-pushed the fix/1331-building-dm-complete branch from 456eec9 to 9cb5ed1 Compare July 24, 2026 22:04
@tiweb442

Copy link
Copy Markdown
Contributor Author

Rebased onto latest main (clean auto-merge — no conflict resolution needed) and pushed.

Also fixed the CI failure in HalvingIntegrationTest: it still expected a second building halve to succeed. Updated it to assert the intended flow — first halve sets dm_halved, second halve is rejected, then complete-building finishes the queue item.

Satisfy PHPStan level 8 nullability checks after the rebase onto main.

Co-authored-by: Cursor <cursoragent@cursor.com>
@tiweb442

Copy link
Copy Markdown
Contributor Author

Follow-up: fixed PHPStan level-8 nullability in the new building DM unit tests by switching User::find to findCurrentUser().

@github-actions

Copy link
Copy Markdown

Preview deployment

Preview environment for this PR is ready for functional testing. Use one of the test accounts below to log in.

Status URL Commit Last deployed
✅ Live https://pr-1496.preview.ogamex.dev bd3722f 2026-07-24 22:27:02 UTC
Test accounts (click to expand)
Email (login) Password Role Class Planets Description
test1@ogamex.dev test admin Collector 2 Admin, high resources, mining focus
test2@ogamex.dev test player General 1 Military focus, ships & fleet
test3@ogamex.dev test player Discoverer 1 Exploration, probes & cargo ships
test4@ogamex.dev test player None 1 New player, no class selected yet
test5@ogamex.dev test moderator Collector 1 Moderator, balanced setup
test6@ogamex.dev test player General 1 Vacation mode enabled
test7@ogamex.dev test player General 3 Heavy defense across planets
test8@ogamex.dev test player Discoverer 1 Fleet focus, inactive (i) 8 days
test9@ogamex.dev test player Collector 1 Beginner, long inactive (I) 40 days
test10@ogamex.dev test player General 5 Endgame, 90 unread messages

This preview will be automatically destroyed when the PR is closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] 2nd time halving with DM shows "halve time" instead of "complete"

2 participants